package com.zhz.system.repository.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhz.common.tool.mybatisplus.base.dal.entity.BasePO;
import com.zhz.common.tool.mybatisplus.base.dal.repository.impl.BaseRepositoryImpl;
import com.zhz.model.system.User;
import com.zhz.model.system.contract.dto.UserDTO;
import com.zhz.model.system.contract.param.UserQueryParam;
import com.zhz.system.repository.dao.UserDao;
import com.zhz.system.repository.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 用户服务实现
 *
 * @author zhouhengzhe
 * @date 2023/3/30
 */
@Service
public class UserServiceImpl extends BaseRepositoryImpl<UserDao, UserDTO, User, UserQueryParam> implements UserService {
    @Override
    protected QueryWrapper<User> getWrapper(UserQueryParam queryParam) {
        return new QueryWrapper<User>()
                .eq(StringUtils.isNotBlank(queryParam.getId()), BasePO.ID, queryParam.getId())
                .eq(StringUtils.isNotBlank(queryParam.getCompanyId()), User.COMPANY_ID, queryParam.getCompanyId())
                .eq(StringUtils.isNotBlank(queryParam.getDepartmentId()), User.DEPARTMENT_ID, queryParam.getDepartmentId())
                .eq(StringUtils.isNotBlank(queryParam.getMobile()), User.MOBILE, queryParam.getMobile())
                ;
    }
}
